import type { CartData } from '../../types/cart'

const cartReducer = (
    state = [] as CartData[],
    action:any) => {
    switch (action.type) {
        case 'cart/addGoods':
            return [...action.payload]
        case 'cart/delGoods':
            return [...action.payload]
        case 'cart/chgeGoods':
            return [...action.payload]
        case 'cart/comGoods':
            return [...action.payload]
        case 'cart/isAllCheck':
            return [...action.payload]
        default:
            return state
    }
    // if(action.type === "cart/addGoods"){
    //     return [...action.payload]
    // }else{
    //     return state
    // }
}
export default cartReducer
